package com.pssr.ui;

import java.awt.Color;
import java.awt.GridBagLayout;
import java.awt.GridLayout;

import javax.swing.BorderFactory;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTabbedPane;

import com.pssr.ui.util.GBC;
import com.pssr.ui.util.IconUtil;

// sdfa
public class MainFrame extends JFrame {

	private static final long serialVersionUID = 3971717650123290277L;
	
	public MainFrame() {
		setTitle("PSSR系统");
		setSize(800, 600);
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setVisible(true);
		
		// 选项卡容器
		JTabbedPane tabPane = new JTabbedPane();
		tabPane.setTabPlacement(JTabbedPane.BOTTOM);
		
		// 选项卡一
		JPanel pane1 = new JPanel(new GridBagLayout());
		pane1.setBackground(Color.RED);
		JLabel projName = new JLabel("项目名称");
		projName.setBorder(BorderFactory.createLineBorder(Color.BLUE));
		pane1.add(projName, new GBC(0, 0, 1, 1).setAnchor(GBC.CENTER).setWeight(1, 0));
		JPanel projPane = new JPanel();
		projPane.setBackground(Color.YELLOW);
		pane1.add(projPane, new GBC(0, 1, 1, 1).setFill(GBC.BOTH).setWeight(1, 1));
		
		// 选项卡二
		JPanel pane2 = new JPanel();
		pane2.setBackground(Color.GREEN);
		
		// 选项卡三
		JPanel pane3 = new JPanel();
		pane3.setBackground(Color.BLUE);
		
		
		tabPane.addTab("title1", IconUtil.getIcon("images/5.png", 20, 20), pane1, "tooltips for title1");
		tabPane.addTab("title2", IconUtil.getIcon("images/6.png", 20, 20), pane2, "tooltips for title2");
		tabPane.addTab("title3", IconUtil.getIcon("images/7.png", 20, 20), pane3, "tooltips for title3");
		
		getContentPane().add(tabPane);
		
	}
	
	public static void main(String[] args) {
		new MainFrame();
	}

}
